<template>
  <div>
    <!-- 按钮 -->
    <el-button style="margin:10px" type="primary" icon="el-icon-refresh-right" circle
      @click="pageAdvertisementRecordList"></el-button>
    <!--    <el-input placeholder="请输入搜索内容在点击搜索" v-model="searchText" style="width:300px;background-color: #fff;">
      <el-button slot="append" icon="el-icon-search" @click="pageAdvertisementRecordList"></el-button>
    </el-input>
    <el-button style="margin:10px" @click="reSetting">重置</el-button> -->
    <!-- 表格
      data 展示数据 —— 数组类型
    -->
    <el-table style="width: 100%;" border :data="list">
      <!--     <el-table-column
            type="selection"
            width="55">
          </el-table-column> -->
      <!--  <el-table-column prop="adUserWithdrowId" label="用户提现表id" width="80" align="center">
      </el-table-column> -->
      <el-table-column prop="accountDetailId" label="订单id" width="100" align="center">
      </el-table-column>
      <el-table-column prop="money" label="提现金额" align="center">
      </el-table-column>
      <!-- <el-table-column prop="userName" label="广告商用户" align="center">
      </el-table-column> -->
      <el-table-column prop="alipayAccount" label="支付宝账号" align="center">
      </el-table-column>
      <el-table-column label="审核结果" align="center" width="100"
        :filters="[{ text: '审核驳回', value: '-1' }, { text: '未审核', value: '0' }, { text: '审核通过', value: '1' }]"
        :filter-method="filterTag" filter-placement="bottom-end">
        <template slot-scope="{ row, $index }">
          <p v-if="row.auditStatus == -1">审核驳回</p>
          <p v-else-if="row.auditStatus == 0">未审核</p>
          <p v-else>审核通过</p>
        </template>
      </el-table-column>
      <el-table-column label="驳回原因" align="center">
        <template slot-scope="{ row, $index }">
          <p v-if="row.auditStatus == -1">{{ row.auditResult }}</p>
        </template>
      </el-table-column>
      <el-table-column prop="createTime" label="创建时间" align="center">
      </el-table-column>
    </el-table>
    <!-- 分页 -->
    <el-pagination style="margin-top:20px;text-align:center" @size-change="handleSizeChange"
      @current-change="handleCurrentChange" :current-page="pageNumber" :page-sizes="[10, 50, 100]" :page-size="pageSize"
      layout="total, sizes, prev, pager, next, jumper" :total="total">
    </el-pagination>
  </div>
</template>

<script>
import moment from 'moment'
export default {
  name: 'WithdrawalAdvertiser',
  mounted() {
    //获取列表数据方法
    this.pageAdvertisementRecordList()
  },
  data() {
    return {
      //页码
      pageNumber: 1,
      //每页数量
      pageSize: 10,
      //总条数
      total: 0,
      //列表数据
      list: [],
      // ids:[],
      //搜索
      searchText: '',
    }
  },
  computed: {
    auditTime: () => {
      return (timestamp, timestamp1) =>
        timestamp - Date.parse(new Date()) / 1000 > 0 ?
          "0" :
          timestamp1 - Date.parse(new Date()) / 1000 < 0 ?
            "2" :
            "1";
    },
  },
  methods: {
    //时间格式化
    dateFormat(row) {
      return moment(row.extensionStartTime * 1000).format("YYYY-MM-DD");
      // return moment(row.startTime * 1000).format("YYYY-MM-DD HH:mm:ss");
    },
    dateFormat1(row) {
      return moment(row.extensionEndTime * 1000).format("YYYY-MM-DD");
    },
    //      handleSelectionChange(val){
    //        console.log(val)
    //        this.ids = val.map((item, index) => {
    // 						return item.id;
    // 					}).join(",");
    //           console.log(this.ids)

    //      },
    async pageAdvertisementRecordList() {
      let res = await this.$API.members.getLoginUserAdUserWithdrowList({
        pageNumber: this.pageNumber,
        pageSize: this.pageSize,
        orderBY: '',
      })
      console.log(res)
      this.total = res.data.sumLine;
      this.list = res.data.rows;
    },
    reSetting() {
      this.searchText = '';
      this.pageAdvertisementRecordList();
    },
    handleSizeChange(val) {
      // console.log(`每页 ${val} 条`);
      this.pageSize = val
      this.pageAdvertisementRecordList()
    },
    handleCurrentChange(val) {
      // console.log(`当前页: ${val}`);
      this.pageNumber = val
      this.pageAdvertisementRecordList()
    },
    filterTagTG(value, row) {
      console.log(value, row)
      return row.status == value;
    },
    filterTag(value, row) {
      console.log(value, row)
      return row.auditStatus == value;
    },
    filterHandler(value, row, column) {
      // const property = column['property'];
      // return row[property] === value;
    }
  }
}
</script>

<style></style>
